Skip to content

stm32 ospi driver : run application in external flash memory XIP #93032

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

FRASTM
Copy link
Contributor

@FRASTM FRASTM commented Jul 11, 2025

Following the stm32h5 run application in external flash memory XIP

This PR makes the samples/sysbuild/with_mcuboot --sysbuild running on the stm32u585 disco kit

Requires the ./bootloader/mcuboot/bootzephyr/boards/b_u585i_iot02a.conf :

CONFIG_BOOT_DIRECT_XIP=y
CONFIG_STM32_MEMMAP=y

run the west build -p -b b_u585i_iot02a samples/sysbuild/with_mcuboot --sysbuild

*** Booting MCUboot v2.1.0-rc1-390-gfbc9aff5acc1 ***
*** Using Zephyr OS build v4.2.0-rc2-72-g8c58be376223 ***
*** Booting Zephyr OS build v4.2.0-rc2-72-g8c58be376223 ***
Address of sample 0x70000000
Hello sysbuild with mcuboot! b_u585i_iot02a

Requires boot/zephyr/boards/b_u585i_iot02a.conf

CONFIG_BOOT_DIRECT_XIP=y
CONFIG_STM32_MEMMAP=y

Define with CONFIG_FLASH_BASE_ADDRESS when the external flash
is on an octoSPI node : "st,stm32-ospi" compatible

Signed-off-by: Francois Ramu <francois.ramu@st.com>
@FRASTM FRASTM force-pushed the stm32u5_xip branch 2 times, most recently from d02c1a8 to f4991ef Compare July 15, 2025 09:50
@JarmouniA
Copy link
Contributor

Requires boot/zephyr/boards/b_u585i_iot02a.conf

CONFIG_BOOT_DIRECT_XIP=y
CONFIG_STM32_MEMMAP=y

MCUboot mode should not be set on MCUboot side in my opinion, it should be set on Zephyr side using Sysbuild (SB_CONFIG_MCUBOOT_MODE_DIRECT_XIP) at the board or app level so that the setting is propagated properly to both MCUboot and App builds.
Furthermore, this approach is creating some problems already, see #93113

FRASTM added 2 commits July 15, 2025 12:17
Add the octoSPI 2 which is connection to a octo NOR flash
mx25lm51245 on the stm32u585 disco kit.
Define the partition on the 64MBytes space of the external flash in the specific
dts file (not the _ns one)
Use the STM32Cube programmer to flash with the corresponding external
loader for XiP mode. Do not mass-erase the internal flash when flashing.
Removing usb_device will avoid test feature for that board.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
Add the OSPI 1 which is an octoSPI connection to a octo NOR flash
mx25lm51245 on the stm32u585 disco kit.
Define the partition on the 64MBytes space of the external flash.
Use the STM32Cube programmer to flash with the corresponding external
loader for XiP mode. Do not mass-erase the internal flash when flashing.
Removing usb_device will avoid test feature for that board.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
@FRASTM
Copy link
Contributor Author

FRASTM commented Jul 15, 2025

Define the partition of the external octo NOR in the b_u858i_iot02a.dts to avoid conflit with the partitioning of the b_u858i_iot02a_ns.dts.

Run the sample to execute in place on the external flash of the
b_u585i_iot02a or stm32h7b3i disco kit,
with_boot application is built and linked for the external flash

Signed-off-by: Francois Ramu <francois.ramu@st.com>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For boards that have enough space/sectors in internal Flash to be used without MemMapped external Flash (with or without MCUboot), I think it makes more sense to create a board variant for the App in Ext Flash usecase.
This way, both configurations can be tested in CI without need for extra overlays..., and users will have ready-to-use configurations to choose from depending on their requirements. This will make the conf on MCUboot side simpler as well.

Copy link

@FRASTM FRASTM changed the title stm32u5 run application in external flash memory XIP stm32 ospi driver : run application in external flash memory XIP Jul 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants